<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<MvcCms.Web.ViewModels.BackOfficeModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    MvcCms -
    <%=ViewData["PageTitle"]%>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="HeaderContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div class="contentpage-outerdiv">
        <h2>
            <%=ViewData["PageTitle"]%></h2>
        <span class="field-validation-error">&nbsp;<%= Html.ValidationSummary("Edit was unsuccessful. Please correct the errors and try again.") %>
            <%=ViewData["message"].ToString()%></span>
        <table width="100%" border="0" cellpadding="0" cellspacing="0" class="data-table">
            <tr>
                <th>
                    &nbsp;
                </th>
                <th>
                    Name
                </th>
                <th>
                    Display Name
                </th>
                <th>
                    Default Language
                </th>
                <th>
                    Theme Name
                </th>
                <th>
                    URL
                </th>
            </tr>
            <% 
                foreach (var item in Model._Portals)
                { %>
            <tr>
                <td>
                    <%if (item.Name != "Default")
                      { %>
                    <a href="javascript:void(0)" onclick="DeletePortal(<%=item.PortalID %>)">Delete</a>
                    |
                    <%} %>
                    <%= Html.ActionLink("Edit", "EditPortal", new { id=item.PortalID }) %>
                </td>
                <td>
                    <%= Html.Encode(item.Name) %>
                </td>
                <td>
                    <%= Html.Encode(item.DisplayName) %>
                </td>
                <td>
                    <%= Html.Encode(item.DefaultLanguage.LanguageName) %>
                </td>
                <td>
                    <%= Html.Encode(item.SkinName) %>
                </td>
                <td>
                    <a href="http://<%= Html.Encode(item.URLAuthority)%>"><%= Html.Encode(item.URLAuthority)%></a>
                </td>
            </tr>
            <% } %>
        </table>
    </div>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="ScriptContent" runat="server">

    <script type="text/javascript">
    function DeletePortal(portalid) {
        if(confirm("Are you sure you want to delete this portal?")){
            window.location.href = "/backoffice/manageportals/" + portalid;
        }
    }
    </script>

</asp:Content>
